package com.youhp.spire.xls.demo.Charts.ManipulateChart;
import com.spire.xls.*;
import com.spire.xls.charts.ChartSerie;
import java.awt.*;

public class ChangeSeriesColor {
    public static void main(String[] args) {
        //Create a Workbook
        Workbook workbook = new Workbook();

        //Load the document from disk
        workbook.loadFromFile("data/ChangeSeriesColor.xlsx");

        //Get the first sheet
        Worksheet sheet = workbook.getWorksheets().get(0);

        //Get the first chart
        Chart chart = sheet.getCharts().get(0);

        //Get the second series
        ChartSerie cs = chart.getSeries().get(1);

        //Set the fill type
        cs.getFormat().getFill().setFillType(ShapeFillType.SolidColor);

        //Change the fill color
        cs.getFormat().getFill().setForeColor(Color.orange);

        //Save the result file
        workbook.saveToFile("output/ChangeSeriesColor.xlsx", ExcelVersion.Version2010);
    }
}
